//
//  ZYOpenURLTool.m
//  ziyun
//
//  Created by ziyun on 16/6/8.
//  Copyright © 2016年 zy. All rights reserved.
//

#import "ZYOpenURLTool.h"
//#import <AlipaySDK/AlipaySDK.h>
//#import "UPPaymentControl.h"
//#import "WXApiManager.h"
//#import "WXApi.h"

@implementation ZYOpenURLTool

+ (BOOL)openURL:(NSURL *)url
{
    
    if ([url.host isEqualToString:@"safepay"]) {//支付宝
        /*
        NSInteger orderType = [[NSUserDefaults standardUserDefaults] integerForKey:kKTPayOrderType];
        [[AlipaySDK defaultService]
         processOrderWithPaymentResult:url
         standbyCallback:^(NSDictionary *resultDic) {
             NSInteger statusCode = [[resultDic objectForKey:@"resultStatus"] integerValue];
             switch (statusCode) {
                 case 9000://成功
                 {
                     //交易成功
                     if (orderType == 1) {
                         [[NSNotificationCenter defaultCenter] postNotificationName:KPayMemberSuccessNotice object:nil userInfo:nil];
                     }else if (orderType == 2){
                         [[NSNotificationCenter defaultCenter] postNotificationName:kPayInSuccessNotice object:nil userInfo:nil];
                     }else if (orderType == 3){
                         [[NSNotificationCenter defaultCenter] postNotificationName:KPayTransferSuccessNotice object:nil userInfo:nil];
                     }else if (orderType == 4){
                         [[NSNotificationCenter defaultCenter] postNotificationName:KPayInventoryScore object:nil userInfo:nil];
                     }else if (orderType == 5){
                         [[NSNotificationCenter defaultCenter] postNotificationName:KPayInventoryScore object:nil userInfo:nil];
                     }
                     
                     
                 }
                     break;
                 case 6001://取消
                 {
                     [ZYTool showError:@"用户取消支付宝交易"];
                 }
                     break;
                 case 6002:
                 {
                     [ZYTool showError:@"网络连接错误"];
                 }
                     break;
                 case 4000:
                 {
                     [ZYTool showError:@"订单支付失败"];
                 }
                     break;
                 case 8000:
                 {
                     [ZYTool showError:@"订单正在处理中"];
                 }
                     break;
                 default:
                     break;
             }
         }];
         */
        return YES;
        
    } else{
//        return [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];
        return YES;

    }
    return YES;
}




@end
